<?php

	//先判断是否有注册信息提交
	if(!empty($_POST)){

		//确认密码校验
		if($_POST['password']!=$_POST['cpassword']){

			echo '<script>alert("密码不一致");history.go(-1);</script>';die;
		}
		//密码加密
		$_POST['password'] = md5($_POST['password']);

		unset($_POST['cpassword']);

		$_rows = add('member',$_POST);

		if($_rows>0){
			//引入邮件发送
			include_once(LIB_PATH.'send_email.php');
			//调用邮件发送函数
			send_email($_POST['email']);
			echo '<script>alert("账号注册成功请到注册的邮箱中激活账号！");location.href="index.php?c=index&a=index";</script>';die;
          
		}else{
			echo '<script>alert("注册失败");history.go(-1);</script>';die;
		}

	}

	// 加载前台公共视图
	include(VIEW_PATH.$admin.'layout.html');